#!/usr/bin/python
# -*- coding: utf-8 -*-
# author: yoshiii.yoshiii@googlemail.com
# you found this code on http://yoshiii-box.googlecode.com/svn/ 
#

#from wxPython.wx import *
import wx
import random
#import sys

dice = [
	"Ja Nein",
	"1 2 3 4 5 6",
	"Ja Nein Vielleicht",
	"arbeiten lesen einkaufen",
#	sys.argv[1:],
	]

class MyApp(wxApp):
    def OnInit(self):
        frame = wxFrame(NULL, -1, "Mein Würfel")
        frame.Show(true)
	
	self.out = wx.TextCtrl(frame, -1, "", (200,0), size=(100, 50))

	b = wx.Button(frame, -1, "Clear", (0,0))
	self.Bind(wx.EVT_BUTTON, lambda e: self.out.Clear(), b)
	b.SetSize(b.GetBestSize())

	y=0
	for die in dice:
	    y += 30
	    b = wx.Button(frame, -1, die, (0,y))
	    self.Bind(wx.EVT_BUTTON, lambda e, d=die: self.role_die(e, d), b)
	    b.SetSize(b.GetBestSize())

        self.SetTopWindow(frame)
        return true

    def role_die(self, event, die):
	self.out.Clear()
	self.out.write( random.choice(die.split()) )

app = MyApp(0)
app.MainLoop()
